package com.canopys.study.open.test.reflect;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 * @Author: Canopys
 * @Descrption:
 * @Date: Created in 23:04 2020/6/3
 * @Modified By:
 */
public class UserProxy implements InvocationHandler {
    private User user;

    public void bind(User user) {
        this.user = user;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("before");
        Object o = method.invoke(user, args);
        System.out.println("after");
        return o;
    }
}
